import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

/**
 * Vuex全局状态管理
 * @param options {Array} 用于渲染tabs的数组
 */
const store = new Vuex.Store({
    state: {
        tableStructData: [],
        activeTab: 'obj',
        dbInstance: '',  //顶部下拉列表的值
        database: ''
    },
    mutations: {
        loadTableStruct(state, data) {
            state.tableStructData = data;
        },
        changeTab(state, tab){
            state.activeTab = tab;
        },
        changeDbInstance(state, inst){
            state.dbInstance = inst;
        },
        setDatabase(state, db){
            state.database = db;
        }
    }
});

export default store;
